﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
		<!-- <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量上报</a>  -->
		<a href="javascript:;" onclick="userAdd('添加用户','user_add.html','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe607;</i> 添加用户</a></span>
	</div>

	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">
				<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
				<th width="30">ID</th>
				<th width="70">用户名</th>
				<th width="100">支行名称</th>
				<th width="100">邮箱</th>
				<th width="100">联系电话</th>
				<th width="80">最后一次上报时间</th>
				<th width="120">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<foreach name="userList" item="vo" >
				<tr class="text-c">
					<!-- <td><input type="checkbox" value="1" name=""></td> -->
					<td>{$vo.uid}</td>
					<td>{$vo.username}</td>
					<td>{$vo.branchname}</td>
					<td>{$vo.email}</td>
					<td>{$vo.tel}</td>
					<td>{$vo.is_report}</td>
					
					<td class="td-status">
						<if condition="$vo.status eq 1 ">
							<span class="label label-success radius">已启用</span>
						<else />
							<span class="label label-defaunt radius">已停用</span>
						</if>
	<!-- 					<if condition="$vo.is_report eq 0 ">
		<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont"></i>未上报</a>	
	<else />
		<a href="javascript:;" onclick="datadel()" class="btn btn-primary radius"><i class="Hui-iconfont"></i>已上报</a>
	</if>
	<if condition="$vo.is_receive eq 0 ">
		<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont"></i>未领用</a>	
	<else />
		<a href="javascript:;" onclick="datadel()" class="btn btn-primary radius"><i class="Hui-iconfont"></i>已领用</a>
	</if> -->
					</td>
					<td class="td-manage">
						<if condition="$vo.status eq 1 ">
							<a style="text-decoration:none" onClick="member_stop(this,'{$vo.uid}')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>
						<else />
							<a style="text-decoration:none" onClick="member_start(this,'{$vo.uid}')" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>
						</if>
						<a style="text-decoration:none" onClick="PasswordReset(this,'{$vo.uid}')" href="javascript:;" title="密码重置"><i class="Hui-iconfont">&#xe63f;</i></a> 
						
					</td>
				</tr>
			</foreach>
		</tbody>
	</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

/*用户-停用*/
function member_stop(obj,uid){
	//console.log(obj);
	layer.confirm('确认要停用吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '__CONTROLLER__/staStop',
			data:{"uid":uid},
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,'+uid+')" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
				$(obj).remove();
				layer.msg('已停用!',{icon: 6,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

/*用户-启用*/
function member_start(obj,uid){
	layer.confirm('确认要启用吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '__CONTROLLER__/staStart',
			data:{"uid":uid},
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,'+uid+')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
				$(obj).remove();
				layer.msg('已启用!',{icon: 6,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});
	});
}

/*密码-重置*/
function PasswordReset(obj,uid){
	layer.confirm('确认重置密码吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '__CONTROLLER__/psReset',
			data:{"uid":uid},
			dataType: 'json',
			success: function(data){
				if(data == 1){
					layer.msg('重置成功!',{icon: 6,time:2000});
				}else{
					layer.msg('重置失败!',{icon: 5,time:1000});
				}
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}
/**
 * 打开添加用户对话框
 */
function userAdd(title,url,w,h){
	layer_show(title,url,w,h);
}

</script> 
</body>
</html>